package demo.helloworld.controller.admin;

import act.controller.Controller;
import demo.helloworld.dto.RestResponse;
import demo.helloworld.dto.Types;
import demo.helloworld.model.Metas;
import demo.helloworld.service.MetasService;
import org.osgl.mvc.annotation.GetAction;
import org.osgl.mvc.annotation.PostAction;

import static act.controller.Controller.Util.*;

import javax.inject.Inject;
import java.util.List;

/**
 * Created by vilen on 2017/3/10.
 */
@SuppressWarnings("unused")
@Controller("admin/links")
public class LinksController {
    @Inject
    private MetasService metasService;

    @GetAction
    public void links() {
        List<Metas> metas = metasService.getMetas(Types.LINK);
        render(metas);
    }

    @PostAction(value = "save")
    public void saveLink(String title,String url, String logo,Integer mid) {
        json(RestResponse.ok());
    }
}
